package com.bite.product.api;


import com.bite.product.model.ProductInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "product-service", path = "/product")
public interface ProductApi {
    @GetMapping("/{productId}")
    ProductInfo getProductInfo(@PathVariable("productId") Integer id);

    @GetMapping("/p1")
    String p1(@RequestParam("id") Integer id);

    @GetMapping("/p2")
    String p2(@RequestParam("name") String name,@RequestParam("id") Integer id);

    @GetMapping("/p3")
    String p3(@SpringQueryMap ProductInfo productInfo);  // feign 远程调用对象时要加注解 @SpringQueryMap

    @RequestMapping("/p4")
    ProductInfo p4(@RequestBody ProductInfo productInfo);
}
